﻿using Youz.Common.Helper;
using Youz.Common.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Youz.Common.BLL
{
    public class ConfigParameters
    {
        private static Sys_ConfigBLL configBLL = new Sys_ConfigBLL();

        public static string GetValue(string key, string defaultValue = null)
        {
            return GetValue(key, defaultValue, "auto", true, "");
        }

        public static string GetValue(string key, string defaultValue, string configType, bool isModify, string memo)
        {
            return configBLL.GetValue(key, configType, isModify, defaultValue, memo);
        }
                
        #region SMTP
        /// <summary>
        /// 邮件服务器地址
        /// </summary>
        public static string SMTPServer
        {
            get { return GetValue("SMTPServer", "mail.kcoin.com", "smtp", true, "邮件服务器地址"); }
        }

        /// <summary>
        /// 邮件服务器端口
        /// </summary>
        public static string SMTPPort
        {
            get { return GetValue("SMTPPort", "25", "smtp", true, "邮件服务器端口"); }
        }

        /// <summary>
        /// 系统发送邮件帐号
        /// </summary>
        public static string SMTPServerUser
        {
            get { return GetValue("SMTPServerUser", "user", "smtp", true, "系统发送邮件帐号"); }
        }

        /// <summary>
        /// 系统发送邮件密码
        /// </summary>
        public static string SMTPServerPassword
        {
            get { return GetValue("SMTPServerPassword", "password", "smtp", true, "系统发送邮件密码"); }
        }
        #endregion


        #region SMS
        /// <summary>
        /// 短信服务器地址
        /// </summary>
        public static string SMSServer
        {
            get { return GetValue("SMSServer", "http://gw.api.taobao.com/router/rest", "SMS", true, "短信服务器地址"); }
        }

        /// <summary>
        /// 短信
        /// </summary>
        public static string AppSecret
        {
            get { return GetValue("AppSecret", "123", "SMS", true, "短信"); }
        }

        /// <summary>
        /// 短信
        /// </summary>
        public static string AppKey
        {
            get { return GetValue("AppKey", "123", "SMS", true, "短信"); }
        }
        /// <summary>
        /// 短信服务器地址
        /// </summary>
        public static string SMSServer1
        {
            get { return GetValue("SMSServer1", "http://210.51.190.233:8085/mt/mt3.ashx", "SMS", true, "短信服务器地址"); }
        }

        /// <summary>
        /// 短信
        /// </summary>
        public static string AppSecret1
        {
            get { return GetValue("AppSecret1", "Windows123321", "SMS", true, "短信"); }
        }

        /// <summary>
        /// 短信
        /// </summary>
        public static string AppKey1
        {
            get { return GetValue("AppKey1", "hongfeng", "SMS", true, "短信"); }
        }
        #endregion

        /// <summary>
        /// 系统致命错误邮件接收人
        /// </summary>
        public static string SystemWarnEmail
        {
            get
            {
                return GetValue("SystemWarnEmail", "jsonzheng@qq.com", "sys", true, "系统致命错误邮件接收人");
            }
        }

        /// <summary>
        /// 客服邮箱
        /// </summary>
        public static string ServiceEmail
        {
            get
            {
                return GetValue("ServiceEmail", "jsonzheng@qq.com", "sys", true, "客服邮箱");
            }
        }


        /// <summary>
        /// 金钱单位
        /// </summary>
        public static string MoneyUnit
        {
            get { return GetValue("MoneyUnit", "$", "sys", true, "金钱单位"); }
        }

        /// <summary>
        /// 当前系统时间
        /// </summary>
        public static DateTime SysTime
        {
            get
            {
                return DateTime.Now;//.AddHours(Convert.ToDouble(GetValue("TimeDiff", "8", "sys", true, "UTC时间差")));
            }
        }

        /// <summary>
        /// 当前系统日期
        /// </summary>
        public static DateTime SysDate
        {
            get
            {
                return SysTime.Date;
            }
        }


        /// <summary>
        /// 默认语言
        /// </summary>
        public static string DefaultLanguage
        {
            get { return GetValue("DefaultLanguage", "zh-cn", "sys", true, "默认语言"); }
        }

        /// <summary>
        /// 开启会员实名认证
        /// </summary>
        public static bool EnabledMemberCerified
        {
            get { return ConfigParameters.GetValue("EnabledMemberCerified", "1", "sys", true, "开启会员实名认证") == "1"; }
        }

        public static string BankNameList
        {
            get { return ConfigParameters.GetValue("BankNameList", "ICBC|中国工商银行,ABC|中国农业银行,CCB|中国建设银行,CMB|招商银行,BOC|中国银行,PSBC|中国邮政储蓄银行,COMM|交通银行,CITIC|中信银行,CMBC|中国民生银行,CEB|中国光大银行,CIB|兴业银行,SPDB|浦发银行,GDB|广发银行,SPABANK|平安银行,HXBANK|华夏银行,BJBANK|北京银行,SHBANK|上海银行,JSBANK|江苏银行,BJRCB", "sys", true, "添加银行卡可选择银行列表"); }
        }
    }
}
